package com.shoukaiseki.test.eurekaserverdemo;

import com.shoukaiseki.test.eurekaserver.feign.ServiceFeignApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.stereotype.Component;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class Application {

    public static void main(String[] args) {
//        System.setProperty("spring.config.name", "test-app");
//        new SpringApplicationBuilder(Application.class) .web(true) .run(args);
        SpringApplication.run(ServiceFeignApplication.class, args);
    }

}

/**
@Component
class LoadBalancerExample implements CommandLineRunner {

    @Autowired(required=false)
    private LoadBalancerClient loadBalancer;

    @Override
    public void run(String... strings) throws Exception {
        ServiceInstance instance1 = loadBalancer.choose("service-hi");
        System.out.println("SERVICE1                           " + instance1.getUri());
    }
}
 **/
